//
//  UserMacro.h
//  MobileMedical
//
//  Created by unionx on 2017/5/12.
//  Copyright © 2017年 unionx. All rights reserved.
//

//用户相关的
#ifndef UserMacro_h
#define UserMacro_h

#if 1 //def DEBUG
//# define WXLog(fmt, ...) NSLog((@"[文件名:%s]\n" "[函数名:%s]\n" "[行号:%d] \n" fmt), __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
# define DDLog(fmt, ...) NSLog((@"[函数名:%s]\n" "[行号:%d] \n" fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DDLog(...);
# define NSLog(...);
#endif


//对弱引用self
#define kWeakSelf(self)  __weak typeof(self) weakself = self;
#define kStrongSelf(weakSelf) __strong typeof(weakSelf) strongSelf = weakSelf;
#define kDefaultPageSize  @"20"

#define kUserId kUserLoginID?:@""


#define beNil(aString) (([aString isKindOfClass:[NSNull class]]|| aString==nil||((NSString *)aString).length == 0))
#define kUserIsLogin   @"kUserIsLogin"


#define kSessionIDStr   [kUserDefault objectForKey:@"cookietSeID"] //登录成功之后的seeionID
#define kAppVersion     [[NSBundle mainBundle].infoDictionary objectForKey:@"CFBundleShortVersionString"]//版本号
#define kAboutDeviceStr [NSString stringWithFormat:@"%@;%@;%@;%@",[UIDevice currentDevice].model,\
[UIDevice currentDevice].systemName,[UIDevice currentDevice].systemVersion,\
[UIDevice currentDevice].identifierForVendor.UUIDString]
//当前设备的分辨率
#define kScreenScaleHeightAndWidth [NSString stringWithFormat:@"%.f*%.f",kScreenScale*kScreenBoundHeight,\
kScreenScale*kScreenBoundWidth]
//设置网络请求的 自定义agent
#define kUserAgentStr  [NSString stringWithFormat:@"%@;%@;%@;kefu",kAboutDeviceStr,\
kScreenScaleHeightAndWidth,kAppVersion]


#define kRootViewController [UIApplication sharedApplication].delegate.window.rootViewController



#define kTokenDefaultKey         @"kTokenDefaultKey"//存在本地的键值对的key值
#define kVersionUserDefaultKey         @"kVersionUserDefaultKey"//存在本地的键值对的key值
#define kVersionUserIsLoginKey         @"kVersionUserIsLoginKey"//登录还是登出
#define kVersionLoginName              @"kVersionLoginName"     //登录名
#define kVersionLoginID                @"kVersionLoginID"     //登录ID
#define kVersionLoginPassword          @"kVersionLoginPassword" //登录密码
#define kVersionLoginEncryptPassword   @"kVersionLoginEncryptPassword" //登录加密密码


#define kUserDefault [NSUserDefaults standardUserDefaults]

#define kTokenID       [kUserDefault objectForKey:kTokenDefaultKey]//tokenID
#define kUserLoginID       [kUserDefault objectForKey:kVersionLoginID]//登录用户ID
#define kUserLoginName       [kUserDefault objectForKey:kVersionLoginName]//登录用户名
#define kUserLoginPassword   [kUserDefault objectForKey:kVersionLoginPassword]//  登录密码
#define kUserEncryptPassword [kUserDefault objectForKey:kVersionLoginEncryptPassword]//  登录加密密码//




/**
 *  针对在选择图片或相机页面时收到视频或语音的请求－－发出相关的通知
 */
#define kMutSelectPhotoAlbumVCDismissNotification @"kMutSelectPhotoAlbumVCDismissNotification"//选择多张图片的VC 消失的通知
#define kOneSelectPhotoAlbumVCDismissNotification @"kOneSelectPhotoAlbumVCDismissNotification"//选择单张图片或相机的vc 消失的通知


#define kLoginStatus   if(![kUserDefault boolForKey:kUserIsLogin]) \
{ \
    [AlertViewManager showAlertViewWithTitle:@"您尚未登录!请先登录~" Message:@"" cancelTitle:@"取消" confirmTitle:@"登录" handlerBlock:^{ \
        LoginViewController *login = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle] ]instantiateViewControllerWithIdentifier:@"LoginVC"];\
        login.isPresent = YES;\
        [self presentViewController:login animated:YES completion:nil];\
    }]; \
    return;\
} 







#define kBookTuWenSucessAction @"kBookTuWenSucessAction"//预约图文咨询成功
#define kBookOtherServerSucessAction @"kBookOtherServerSucessAction"//预约其他成功



#endif /* UserMacro_h */
